package com.longge.wechat.controller.wx;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.longge.wechat.communication.Poster;
import com.longge.wechat.message.resp.RespTextMessage;
import com.longge.wechat.utils.XmlUtil;



@Controller
public class VoiceController {


	@RequestMapping(value = "/voice.do", method = RequestMethod.POST)
	public void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String openId = (String) request.getAttribute("openId");
		String from = (String) request.getAttribute("from");
		String rs = "消息已收到";
		
		RespTextMessage message = new RespTextMessage(openId,from,rs);
		Poster.post(response, XmlUtil.getInstance().bean2xml(message,null,null));
	}
}
